import { BinaryDecision } from "framework/FSM/DecisionTree/Decision";
 
/**
 * 生产的商品已经清理了
*/
export class DecisionIsProductionClean <T extends IStateArg<Room>> extends BinaryDecision<T>
{

    public testValue(arg:T): boolean
    {
        const toptask = arg.entity.getTaskByType("factory")[0]?.data ;
        
        const core = arg.entity.getEntity("CoreEntity");

        if(toptask  && core.Factory)
        {
             if(core.Factory.store.getUsedCapacity(toptask.arg.TopTask.target) == 0)
            {
                // 最终的生产物清理完了就算完了
                return true;
            }
            return false;
        }
        else
        {
            throw new Error(`${arg.entity.GUID} topreactiontask is null`);
        }
        // return false
    }

}

